
package ch.hearc.coursJava.kitBase.tools;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class TabToolsTest
	{

	/*------------------------------------------------------------------*\
	 |*							Constructeurs							*|
	 \*------------------------------------------------------------------*/

	@Before
	public void before()
		{
		// rien
		}

	@After
	public void after()
		{
		// rien
		}

	/*------------------------------------------------------------------*\
	 |*							Methodes Public							*|
	 \*-----------------------------------------------------------------*/

	@Test
	public void testClone()
		{
		double[][] matriceSource = new double[][] { { 1, 2 }, { 3, 4 }, { 5, 6 } };
		double[][] matriceClone = TabTools.cloner(matriceSource);

		assertTrue(TabTools.isEgal(matriceSource, matriceClone));

		matriceSource[0][0] = 10;
		assertFalse(TabTools.isEgal(matriceSource, matriceClone));
		}

	@Test
	public void testProduit()
		{
		double[][] matrice1 = new double[][] { { 1, 2 }, { 3, 4 }, { 5, 6 } };
		double[][] matrice2 = new double[][] { { 1, 2, 3, 4 }, { 5, 6, 7, 8 } };

		double[][] matriceResultatTheorique = new double[][] { { 11, 14, 17, 20 }, { 23, 30, 37, 44 }, { 35, 46, 57, 68 } };
		double[][] matriceResultat = TabTools.produit(matrice1, matrice2);

		assertTrue(TabTools.isEgal(matriceResultat, matriceResultatTheorique));
		}
	/*------------------------------------------------------------------*\
	|*							Methodes Private						*|
	\*------------------------------------------------------------------*/
	}
